-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RelateNG algorithm for DE-9IM relationship evaluation #1052
Conversation
Signed-off-by: Martin Davis <[email protected]> Move to src dir Signed-off-by: Martin Davis <[email protected]> More code Signed-off-by: Martin Davis <[email protected]> Get it running Signed-off-by: Martin Davis <[email protected]> Fix conflict Add more short-circuits Signed-off-by: Martin Davis <[email protected]> Refactoring, add collinear intersection Signed-off-by: Martin Davis <[email protected]> Add license, more predicates Signed-off-by: Martin Davis <[email protected]> Renaming Signed-off-by: Martin Davis <[email protected]> Renaming, fix L/L short-circuit Signed-off-by: Martin Davis <[email protected]> WIP - more detailed intersection info Signed-off-by: Martin Davis <[email protected]> Add geometry dimensionality checks Signed-off-by: Martin Davis <[email protected]> Add LinearBoundary Signed-off-by: Martin Davis <[email protected]> Add header, fix imports Rename IMPredicate methods Refactoring Refactoring remove dead code Refactor predicate model Refactor predicate model refactoring Add point support Simplify builder logic Fix proper intersection logic renaming code reorg Refactoring refactoring Fix order of EdgeIntersector comparison Add AreaArea crossing test Enhance PolygonNodeTopology to handle collinear Add predicates Javadoc Add node edge handling cleanup fix imports Add node evaluation Various improvements Various improvements Fix touches bug Renaming, fixes Renaming, fixes Improve tests Improve perf test Add PredicateTracer Add short-circuit Fix some bugs Renaming Refactoring refactoring Avoid check for empty element Fix area-vertex evaluation Remove unused import Renaming Renames Renames Refactor constants Renaming, refactoring refactoring refactoring rename TopologyPredicateValue renaming use constant renaming initial commit for self-noding Add RelateNG functions Refactor addAreaEdge Add AB geometry edge intersection test formatting Refactoring to simplify Remove single-call method Refactoring Renaming various improvements typo in comment various improvements refactoring Chg addEdge method sig Fix unit test Improve tracing output Finish self-intersection handling Expose constants javadoc, refactoring Switch to HPRtree Refactoring formatting Refactor predicate logic functions Improve predicate logic shortcut methods simplify code add method improve msg add tests Add relate function Various fixes change evaluation order Rework point topology evaluation refactoring refactoring javadoc, renaming remove dead code Improve relate predicate code improve internal API rename TopologyPredicate.value add perf tests refactoring Add BoundaryNodeRule support Fix SegmentString method usage Align with master Align with master Add headers Change classes to package-private Javadoc Improve TopologyPredicate API Refactor predicate API Refactor Predicate API Remove return value, rename javadoc Remove TopologyPredicateValue Refactor predicates renaming Add more functions Add RelateNG unit test base class Javadoc Refactoring, add GC handling various improvements Imrove GC point locating Add simple relate test renaming, testing renaming Improve node location computation Minor changes Introduce node sections to pass intersections refactoring Refactoring remove dead code refactoring TopologyBuilder refactoring Refactor topology logic simplify topology building logic reafactoring fix unit test Javadoc, refactoring refactor refactoring, modularization Add equalsTopo function Add polygon id Add tests doc refactoring Fix adjacent function Refactor out MaskPredicate Refactoring Fix RelateMaskPredicate logic cleanup Fix Relate mask predicate Improve node evaluation logic Add constants for relate patterns Fix adjacent test Improve RelateNG functions Improve AdjacentPolygons perf test Renaming Modularize NodeSections minor code cleanup Javadoc Regularize code Add tests Simplify intersection handling remove unused method disambiguate method Add node section inversion Improve NodeSection sorting refactoring, code cleanup Improve unit test Add PolygonNodeInverter unit test Generalize node conversion algorithm Fix headers Add PolygonNodeConverter unit test rename collect method javadoc Add NG functions code cleanup Javadoc Javadoc Code cleanup remove dead code Handle point location on GC adjacent edges Renaming Change to using MCIndexSegmentSetMutualIntersector Fix bug in AdjacentEdgeLocator Switch to using isOnSegment Minor code improvements Add unit test Change to package visible Fix how nodes are located on boundaries Javadoc Javadoc Add fix for overlapping GCs with hole Fix polygon touching interior endpoint Add area-line at point interaction update Javadoc, arg order Code cleanup, naming, refactoring Refactor Refactor DimensionLocation.EXTERIOR Implement prepared RelatePointLocator Change to using pattern from mask Change to pattern from mask Improve performance tests Improve point testing performance Javadoc Update copyright Add XML GC tests Add package Javadoc Update package Javadoc Rename RelateNG method Add RelatePatternPredicate short-circuit remove debug lines change method visibility Refactor RelateNG API Refactor API Move LinearBoundary into RelatePointLocator Refactor Locator Improve GC scanning Code cleanup, refactoring Javadoc Change API Refactor IM pattern API javadoc, method renaming Javadoc Refactoring renaming Renaming change visibility to package Renaming Javadoc Javavdoc Add Relate issue tests Add unit tests Improve Tracer API Cache geometry empty status Add potential optimization Add unit tests for zero-len line Remove bad test Javadoc Javadoc Fix handling of repeated points Javadoc Add optimization to skip disjoint geoms in point tests Fix EdgeSegmentIntersector deduplication Javadoc, refactoring Add unit test Add zero-length line test Javadoc Javadoc Javadoc
public void testPoint() { | ||
//String wkt = "GEOMETRYCOLLECTION (POINT(0 0), POINT(1 1))"; | ||
checkLocation(gcPLA, 1, 1, DimensionLocation.POINT_INTERIOR); | ||
checkLocation(gcPLA, 0, 1, Location.EXTERIOR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't thing this test comparing a Location to a DimensionLocation makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact DimensionLocation.EXTERIOR = Location.EXTERIOR
(see here). So this is techically correct - but it would be better to use the DimensionLocation
value. I'll fix that.
Also, would be better if the check method was called checkDimLoc
to be clear - I'll change that too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed: 8c71ae7
…dicates and relate matrix calculations. * No new functions, just rework of existing functionality * "Prepared" mode now available for all predicates and relate matrix * CAPI functions GEOSPreparedRelate and GEOSPreparedRelatePattern expose new functionality * CAPI implementations of GEOSPreparedTouches, etc, that were previously defaulting into non-prepared implementations now default into the RelateNG prepared implementation * Prepared implementations for Intersects, Covers, still use the older implementations * https://lin-ear-th-inking.blogspot.com/2024/05/jts-topological-relationships-next.html * https://lin-ear-th-inking.blogspot.com/2024/05/relateng-performance.html
packaging changes: - change to cmake/build.mk - set test target (tests pass on NetBSD 10 amd64) - update HOMEPAGE - adjust revbumping instructions, because depending pcakages no longer wrongly link to the C++ library * NEWS: Changes in 3.13.0 (2024-09-06) - New things: - Add Angle::sinCosSnap to avoid small errors, e.g. with buffer operations (GH-978, Mike Taves) - Add classes for curved geometry types: CircularString, CompoundCurve, CurvedPolygon, MultiCurve, MultiSurface (GH-1046, Dan Baston/German QGIS users group/Canton of Basel-Landschaft/Canton of Zug) - Support curved geometry types in WKT/WKB readers/writers (GH-1046, GH-1104, GH-1106, Dan Baston) - 3D read and write support for GeoJSON (GH-1150, Oreilles) - Port of RelateNG locationtech/jts#1052 (Martin Davis, Paul Ramsey) - Rewrite of boolean predicates and relate matrix calculations - "Prepared" mode now available for all predicates and relate matrix - CAPI functions GEOSPreparedRelate and GEOSPreparedRelatePattern expose new functionality - CAPI implementations of GEOSPreparedTouches, etc, that were previously defaulting into non-prepared implementations now default into the RelateNG prepared implementation - Prepared implementations for Intersects, Covers, still use the older implementations - https://lin-ear-th-inking.blogspot.com/2024/05/jts-topological-relationships-next.html - https://lin-ear-th-inking.blogspot.com/2024/05/relateng-performance.html - Breaking Changes - Zero-length linestrings (eg LINESTRING(1 1, 1 1)) are now treated as equivalent to points (POINT(1 1)) in boolean predicates - CMake 3.15 or later is requried (GH-1143, Mike Taves) * https://libgeos.org/posts/2024-09-06-geos-3-13-released/ This secion restates the NEWS with a different organization. The headline features of this release are: - A new approach to boolean predicates via RelateNG - Faster performance for many cases where a short circuit is available - Avoiding the full computation of a topology graph for every call - Ability to use a high speed “prepared” approach for the complete set of predicates as well as the relate matrix functions - Initial support for ISO SQL/MM curve types - Create, read and write support for CircularString, CompoundCurve, CurvedPolygon, MultiCurve, MultiSurface This release includes the following new features in the C API (and of course underlying changes to the C++ code to support these features): - GEOSGeom_createEmptyCircularString() creates a new empty CircularString - GEOSGeom_createCircularString(coordseq) creates a CircularString with the supplied coordinates - GEOSGeom_createEmptyCompoundCurve() creates a new empty CompoundCurve - GEOSGeom_createCompoundCurve(curves, ncurves) creates a CompoundCurve with the supplied components (start/end coordinates must match up) - GEOSGeom_createEmptyCurvePolygon() creates a new empty CurvePolygon - GEOSGeom_createCurvePolygon(shell, holes, nholes) creates a CurvePolygon with the supplied rings - GEOSPreparedRelate(prepgeom, geom) generates a DE9IM intersection matrix for the geometry pair, where one input has been “prepared” for fast repeated calls - GEOSPreparedRelatePattern(prepgeom, geom, pattern) tests a pair of geometry against a known DE9IM pattern to see if the relationship is consistent with the pattern
This PR contains the new RelateNG algorithm for evaluating the DE-9IM matrix and topological predicates for geometry pairs.
The RelateNG algorithm has the following capabilities:
GeometryCollection
inputs containing mixed types and overlapping polygons are supported, using union semantics.BoundaryNodeRule
s.Initially this is provided as a user-callable option. A subsequent version will use this algorithm for
Geometry
methods. It will also replace thePreparedGeometry
implementation (with the API preserved for some number of versions).This algorithm fixes the issues summarized in libgeos/geos#1060.